package com.project.bean;

import javax.validation.constraints.*;

/**
 * 学生实体类
 */
public class StudentBean {
    /**编号*/
    private int id;
    /**姓名*/
    @NotBlank(message = "姓名必须填写")
    @Pattern(regexp = "[a-zA-Z\\u4e00-\\u9fa5]{2,}",message="姓名为两位以上的汉字或字母")
    private String name;
    /**电话*/
    @Pattern(regexp = "1[3578]\\d{9}",message = "电话必须为13、15、17、18开始的11位数")
    private String phone;
    /**邮条*/
    @Email(message = "邮箱格式为XX@XX.com")
    private String email;
    /**成绩*/
    @Max(value = 100,message = "最高分为100分")
    @Min(value = 0,message = "最低分为0分")
    private Integer grade;
    /**头像*/
    private String face;
    /**所在班级*/
    private ClassBean classBean;

    public StudentBean() {
    }

    public StudentBean(String name,String phone, String email, Integer grade, String face, int classId) {
        this.name = name;
        this.phone = phone;
        this.email = email;
        this.grade = grade;
        this.face = face;
        this.classBean = new ClassBean();
        this.classBean.setId(classId);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    public String getFace() {
        return face;
    }

    public void setFace(String face) {
        this.face = face;
    }

    public ClassBean getClassBean() {
        return classBean;
    }

    public void setClassBean(ClassBean classBean) {
        this.classBean = classBean;
    }

    @Override
    public String toString() {
        return "StudentBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", grade=" + grade +
                ", face='" + face + '\'' +
                ", classBean=" + classBean +
                '}';
    }
}
